<%-- 
    Document   : login
    Created on : May 13, 2011, 4:04:19 AM
    Author     : Stephen Moulton
--%>
<%@page import="java.util.Vector"%>
<%
    String user_id = (String) session.getAttribute("login");
    //id = Integer.parseInt(session.getAttribute("login"));
    if (user_id != null) {
        String user = (String)session.getAttribute("user");
        out.println("Welcome, " + user + "<br/>");
        out.println("<a href='account.jsp'>Account here</a><br/><a href='logout.jsp'>Logout</a>");
    } else {
%>

<form method= "post" action="Login">
    <table>
        <tbody>
            <tr>Login Site</tr>
            <tr>
                <td>
                    <input type="text" style="height:18px;width: 160px;" id="name" name="logemail"/> Email
                </td>
            </tr>
            <tr>
                <td>
                    <input type="password" style="height:18px;width: 160px;" id="mailing" name="pass"/> Password
                </td>
            </tr>
            <tr>
                <td>
                    <input type="submit" value="Login" />
                </td>
            </tr>
        </tbody>
    </table>
</form>
<div>No account? <a href="register.jsp">Register here</a></div>
<%       }

    String loginStatus = request.getParameter("l");

    if (loginStatus != null) {
        if (loginStatus.equals("s")) {
            out.println("<div class=\"subcriber-green\">You have login sucessfully!</div>");
            Vector itemList = new Vector();
            session.setAttribute("items",itemList);
        } else if (loginStatus.equals("e")) {
            out.println("<div class=\"subcriber-red\">Login Fail!</div>");
        }  
     }

%>

